import { defineStore } from 'pinia'


export const useuidStore = defineStore('userphonedata', {
	state: () => {
		return {
			user:{
				uid: "",
				avatarUrl:"",
				nickname:"",
			},
			artistid:"",
			artistsongs:"",
		}
	},
	actions: {
		saveUser(uid,avatarUrl,nickname) {
			this.user.uid = uid
			this.user.avatarUrl = avatarUrl
			this.user.nickname = nickname
		},
		saveId(artistid){
			this.artistid = artistid
		},
		saveArtistsongs(artistsongs){
			this.artistsongs = artistsongs
		}
	},
    getters:{
        userInfo:(state)=>state.user,
        artistidInfo:(state)=>state.artistid,
        artistsongsInfo:(state)=>state.artistsongs,
    },
	persist: {
	enabled: true,
	strategies: [
		{
			key: 'user',
			storage: localStorage,
		},
	],
},
})
